rbm_targets(7)
==============

NAME
----
rbm_targets - rbm targets configuration

DESCRIPTION
-----------

When you are building packages you might want to build them in different
situations, with different options. The targets allow you to define
those options.

For instance you could be doing nightly builds of your packages, local
test builds when you are working on the developpement of a new feature,
and from time to time build a package for a new release. In such
situation, you could use command line arguments to change the options,
or change the config file each time, but that is not very convenient.
Instead you can define targets with any number of options, and use a
single argument to select the target.

CONFIGURATION
-------------

The targets can be defined in any of the configuration files, using the
'targets' option. This option is an hash, with the target names as keys,
and as value an other hash containing the options to be used for this
target.

As an example we could define the following targets :

- the 'dev' target, for daily development, from the master branch. You
  don't to use pbuilder, so you can have your package built more quickly.
  You don't want to sign the packages. And you want this target to be the
  default.

- the 'release' target, for building packages for a new release. You
  want to use pbuilder to make sure it is built in a clean chroot. You
  only want to build them from gpg signed tags. You want to sign the
  packages with a specific key.

In such case, the following targets configuration could be used :
----
targets:
  dev:
    git_hash: master
    use_pbuilder: 0
  release:
    use_pbuilder: 1
    debsign_keyid: 123456
    tag_gpg_id: 1
----

If the value of a target is not a hash containing options, but a string
or an array of strings, then this or those names are used as targets.
This is useful if you want to say that a target is the same as an other
one, or to extend a target.

You can use this if you want to set a default target. When no target
has been selected, the 'notarget' target is used. In this example, we
set 'dev' as the default target:
----
targets:
  notarget: dev
  dev:
    git_hash: master
    use_pbuilder: 0
  release:
    use_pbuilder: 1
    debsign_keyid: 123456
    tag_gpg_id: 1
----

In this example we extend the 'release' target as 'release_1' to add a
+git_hash+:
----
targets:
  release_1:
   - git_hash_version_1
   - release
  release:
    use_pbuilder: 1
    debsign_keyid: 123456
    tag_gpg_id: 1
  git_hash_version_1:
    git_hash: version-1.0
----

COMMAND LINE OPTION
-------------------

The target to be used can be selected with the '--target' command line
option. You can select more than one target by giving the option multiple
times, and in this case they will be used in the order given on the
command line. If no target is selected, then the 'notarget' target is
used.

For example, if you want to build a debian package for 'dev' target :
----
$ rbm deb --target dev
----

If you want to build a debian package for the 'release' target, using
the '0.1.2.3' tag:
----
$ rbm deb --target release --git-hash 0.1.2.3
----

Sometime, an option in one project will use the value of an option from
an other project (with the +pc+ template function, see
link:rbm_templates.html[rbm_templates(7)] for details), or a project
will use the output of an other project as input file (see
link:rbm_input_files.html[rbm_input_files(7)] for details). In such
cases, you may want to select a target to be applied only for a specific
project. This can be done with the following syntax:
----
$ rbm build --target project:target
----

SEE ALSO
--------
link:rbm.html[rbm(1)],
link:rbm_config.html[rbm_config(7)],
